<!DOCTYPE html>
<#assign dicSelect=JspTaglibs["http://www.casic304.cn/dicSelect"] />
<#assign secSelect=JspTaglibs["http://www.casic304.cn/secSelect"] />
<#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />
<html>
<head>
    <meta charset="utf-8">
    <title>质量信得过班组</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/forms/currencyCss.css">
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
    <style>
        .qbdms-TBinformation{margin-left: 0;font-size: 15px}
        .qbdms-TBinformationText{margin-left: 145px;}
        .treeFormPreview{position: unset;padding: 0;padding-top: 12px;margin-top: 80px;}
        .fillBtn{
            background:rgba(38,130,255,1) !important;
        }
    </style>
</head>
<body class="listBody qbdms-particulars">
<#if flag !="1"&&flowStatus!='0'>
<div id="button" style="padding: 20px">
    <a class="layui-btn layui-btn-sm fillBtn" lay-event="" id="detail">
        <i class="iconfont iconicon_file"></i>
        <span>运行明细</span>
    </a>
    <a class="layui-btn layui-btn-sm flowChart fillBtn" lay-event="flowChart">
        <i class="layui-icon layui-icon-picture-fine"></i>
        <span >流程图</span>
    </a>
    <a class="layui-btn layui-btn-sm fillBtn" lay-event="" id="taskOpinion">
        <i class="iconfont iconicon_compile"></i>
        <span>审批历史</span>
    </a>
</div>
</#if>
<div class="qbdms-bodyDiv" >
    <div class="qbdms-backDiv">
        <div class="layui-table-view-body" style="padding: 0 24px 24px;" >
            <div class="qbdms-formTitle"  style="border-bottom: 1px solid #E5F0FF">质量信得过班组 <#if flag !="1"><i  class="qbdms-returnOn closeWindow">返回</i></#if></div>
        <form class="layui-form treeFormPreview" requrl="${ctx}/qbdms/wQbdTrustTeam/get" lay-filter="wQbdTrustTeamDataForm">
            <div class="" style="width: 100%;overflow-x: auto">
                <table class="tableExcel qbdms-zeroTable" width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tbody>
                    <tr id="tbxx"></tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">密级<span style="color: red;">*</span></td>
                        <td colspan="5"><@secSelect.sec_select data_src=1 required=true name="secret"/></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">班组名称<span style="color: red;">*</span></td>
                        <td colspan="5" name="teamname"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">单位<span style="color: red;">*</span></td>
                        <td colspan="5" name="teamdept"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">班组人数<span style="color: red;">*</span></td>
                        <td colspan="5" name="teamcount"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">申报类别<span style="color: red;">*</span></td>
                        <td colspan="5">
                            <@dicSelect.dic name="declares" reqtext="申报类别是必填项" verify="required" nodeKey="bzsblb" />
                        </td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">组长<span style="color: red;">*</span></td>
                        <td colspan="5" name="teamLeaderName">

                        </td>
                    </tr>

                    <tr>
                        <td class="qbdms-zeroTable-lable">创建时间<span style="color: red;">*</span></td>
                        <td colspan="5" name="createTime"></td>
                        <input name="createTime" type="hidden" placeholder="未填写" autocomplete="off" class="layui-input dateTimeFiled input-right time-init" format="yyyy-MM-dd" datetype="date" />
                        </td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">创建目标</td>
                        <td colspan="5" name="createTarget"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">创建计划</td>
                        <td colspan="5" name="createPlan"></td>
                    </tr>
                    <#if flag =="1">
                    <tr>
                        <td class="qbdms-zeroTable-lable">
                            研究室主管领导审批
                        </td>
                        <td colspan="5">
                            <#list taskOpinionNewList as taskOpinionNewList>
                            <#if taskOpinionNewList.taskName == "研究室主管领导审批">
                            <p>${taskOpinionNewList.opinion}</p><br/>
                            <p style="text-align:right;">审批人:${taskOpinionNewList.exeFullname}&nbsp&nbsp&nbsp&nbsp
                                日期:${(taskOpinionNewList.endTime?string("yyyy-MM-dd"))!}</p>
                        </#if>
                    </#list>
                    </td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">
                            质量综合助理员确认
                        </td>
                        <td colspan="5">
                            <#list taskOpinionNewList as taskOpinionNewList>
                            <#if taskOpinionNewList.taskName == "质量综合助理员确定">
                            <p>${taskOpinionNewList.opinion}</p><br/>
                            <p style="text-align:right;">审批人:${taskOpinionNewList.exeFullname}&nbsp&nbsp&nbsp&nbsp
                                日期:${(taskOpinionNewList.endTime?string("yyyy-MM-dd"))!}</p>
                        </#if>
                    </#list>
                    </td>
                    </tr>
                    </#if>
                    </tbody>
                </table>
                <input type="hidden" name="id" placeholder="请输入"
                       autocomplete="off" class="layui-input  textInput"
                       maxlength="50" fieldname="id">

                <input type="hidden" name="teamdeptid" placeholder="请输入单位id"
                       autocomplete="off" class="layui-input  textInput"
                       maxlength="50" fieldname="teamdeptid">
            </div>
            <#if isClose != 'true' && flag !="1">
            <div class="layui-form-item btnformItem">
                <p>
                    <button type="reset" id="closeWindow" class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">返回</button>
                </p>
            </div>
        </#if>

        </form>
    </div>
</div>
</div>

<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>

    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','setter', 'propsHandle', 'laydate', 'jquery', 'common','publicMethods','qbdmsForm'], function () {
        var laydate = layui.laydate;
        var $ = layui.jquery;
        var publicMethods = layui.publicMethods;
        var dateTimeFiledLen = $(".dateTimeFiled");
        var propsHandle = layui.propsHandle;
        var defProps = {
            //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
            viewMould: 'moulds/', // 组件模块 存放文件 *****
            selectorBtn: '.selectorBtn'
        };
        var temQuery = new propsHandle();
        // 初始化模板功能
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });

        for (var i = 0; i < dateTimeFiledLen.length; i++) {
            laydate.render({
                elem: dateTimeFiledLen[i] //指定元素
                , type: 'date'
                , trigger: 'click'
            });
        }

        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            window.location.href = '${ctx}/qbdms/wQbdTrustTeam/view/list';
        });

        var id = "${id}";
        // 注册单位为当前单位
        if (id == null || id == '') {
            $("input[name='teamdept']").val('${filldept}');
            $("input[name='teamdeptid']").val('${filldeptid}');
        }

        //构建file的字符串
        function constructFileStr() {
            var filesJsonStr = "";
            $(this).find(".file-id").each(function () {
                var fileId = $(this).attr("fileid");
                var fileName = $(this).find("span").text();
                var fileLevel = $(this).find("option:selected").val();
                var fileLevelText = $(this).find("option:selected").text();
                filesJsonStr += '{"fileId":"' + fileId + '","fileName":"' + fileName + '","fileLevel":"' + fileLevel + '", "fileLevelText":"' + fileLevelText + '"},';
            });
            filesJsonStr = filesJsonStr.substring(0, filesJsonStr.length - 1);
            if (filesJsonStr != "") {
                filesJsonStr = '[' + filesJsonStr + ']';
            }
            var fileUploadName = $(this).attr("fileUploadName");
            $("#" + fileUploadName).val(filesJsonStr);
        }

        //下载附件
        window.downFile = function (obj) {
            var fileId = $(obj).parents("span").attr("fileId");
            window.location.href = serverPath.qbdmsPath + setter.extendLinkPath + "attachFile/download?fileId=" + fileId;
        }

        //-- 附件上传 结束 --------------------------------------------------------------

        var common = layui.common;
        var index = parent.layer.getFrameIndex(window.name);
        common.updateForm({
            name: 'wQbdTrustTeamDataForm',
            idValue: "${id}",
            primary: "id",
            getCallback: function (data) {
                $("#tbxx").html("<td class='qbdms-zeroTable-lable'>填报信息:</td><td colspan='5' class=''>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</td>");
                // $("#tbxx").html("<span class='qbdms-TBinformation'>填报信息:</span><span class='qbdms-TBinformationText'>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</span>");
                $('.uploadFileList').each(function () {
                    var fileUploadName = $(this).attr("fileUploadName");
                    var jsonFile = data.data[fileUploadName];
                    var files = eval(jsonFile);

                    if (files) {
                        for (var i = 0; i < files.length; i++) {
                            var fileLevel = files[i].fileLevel;
                            var fileLevelText = files[i].fileLevelText;
                            var fileSec = '<div class="fileSecLevel fileSecXg layui-input-inline">' + '<@secSelect.sec_select data_src=1 hasBlank=false/>' + "</div>";
                            var newStr = '<span class="file-id" style="margin-right: 20px;" fileId=' + files[i].fileId + ' fileLevelText="' + fileLevelText + '">' + fileSec + '<span class="file-name" title="点击下载文件" onclick="downFile(this)"><i class="iconfont " style="margin-right: 5px"></i>' + files[i].fileName + '</span></span>';
                            $(this).append(newStr);
                            $(this).find("select:last").val(fileLevel);
                            $(this).find("select:last").attr("disabled", "disabled");
                        }
                    } else {
                        // $(".uploadFileCont").each(function () {
                        //     if ($(this).children('.uploadFileList').children().length == 0) {
                        //         $(this).children('.uploadFileList').append("<span style='color: #C0C4CC'>未上传</span>")
                        //     }
                        // })
                        // $(this).append("<span style='color: #c0c4cc'>未上传</span>");
                    }
                });

                // -------------------- 明细页面判断附件是否存在 -------------------
                $(".uploadFileList").each(function () {
                    if ($(this).text().length === 0) {
                        $(this).append("<span style='color: #C0C4CC'>未上传</span>")
                    }
                })
                // -------------------- 明细页面判断附件是否存在 -------------------

            }
        });

        if ("${isClose}" == "true") {
            $(".closeWindow").hide();
        }
        publicMethods.bottomFixd()
        $("body *").not("#closeWindow").attr("disabled", "disabled");
        $(".uploadFileCont .qbdms-fileUp,.uploadFileCont i,.addFormTr1").hide();
        var flag="${flag}";
        var procInstId = "${processRun.procInstId}";
        var runId = "${runId}";
        if (runId == null || runId == '') {
            $("#hideAndShow").show();
        }

        //运行明细
        $("#detail").click(function () {
            layer.open({
                type: 2,
                title: "运行明细",
                area: ['80%', '80%'],
                btn: ['关闭'],
                skin: 'btn-close',
                btnAlign: 'c',
                content: serverPath.qbdmsPath +'/workflow/processRun/view/detail?runId=' + runId
            });
        });

        //审批历史
        $("#taskOpinion").click(function () {
            parent.layer.open({
                type: 2,
                title: "审批历史",
                area: ['950px', '585px'],
                content: serverPath.qbdmsPath +"/workflow/taskOpinion/view/list?runId=" + runId
            })
        });

        //流程图
        $(".flowChart").click(function () {
            parent.layer.open({
                type: 2,
                title: "流程图",
                shade: 0.3,
                left: 200,
                area: ['1000px', '600px'],
                content: serverPath.qbdmsPath +"/workflow/processRun/view/bpmImg?procInstId="+procInstId+"&runId="+runId,
                btn:['','关闭'],
                success:function (layero,index) {
                    $(layero).find("a.layui-layer-btn0").hide();
                }
            });
        });

    });
</script>
</body>
</html>